<template>
    <div class="comment">
        <ul class="mui-table-view mui-table-view-chevron" v-for = "(item,index) in journalism" :key="index">
				<router-link  :to=" '/hone/content/' + item.id  ">
                <li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" :src="item.img_url">
						<div class="mui-media-body">
							<h4>{{item.title}}</h4>
							<p class='mui-ellipsis'>
                                <span>发布时间:{{item.add_time | time }}</span>
                                <span>点击量:{{item.click}}</span>
                            </p>  
						</div>
					</a>
				</li>
                </router-link>       
		</ul>
    </div>
</template>
<script>
import {getnewslists} from "@/api/index.js";
import { Toast } from "mint-ui";
    export default {
       data(){
        return{
           journalism :[] 
        }
       },
       created(){
        this.list()
       },
       methods:{
         list() {
             getnewslists().then(res =>{
                 console.log(res)
                  if (res.status === 0) {
                        this.journalism = res.message;
                        } else {
                        Toast("加载新闻失败");
                    }
             })
         }
       }
    }
</script>
<style lang="scss" scoped>
.mui-table-view{
      h4{
          font-size: 14px;
          overflow: hidden;
          text-overflow:ellipsis;
          white-space: nowrap; 
      }
      .mui-ellipsis{
          font-size: 12px;
          color: blueviolet;
          display: flex;
          justify-content: space-between;
      }
  }
</style>
